﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using XiaFControl.Controls;
using XiaFControl.Data.Info;
using XiaFControl.Demo.Common;

namespace XiaFControl.Demo.Views
{
    /// <summary>
    /// MessageDemo.xaml 的交互逻辑
    /// </summary>
    public partial class MessageDemo : UserControl
    {
        public MessageDemo()
        {
            InitializeComponent();
        }
        private void MessageBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.Show("message");
        }

        private void InfoBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowInfo("info");
            Growl.Info(new GrowlInfo()
            {
                IsCustom = true,
                StaysOpen = false,
                Message = "info",
                WaitTime = 3
            });
        }

        private void WaringBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowWarning("warning");
            Growl.Warning(new GrowlInfo()
            {
                IsCustom = true,
                StaysOpen = false,
                Message = "warning",
                WaitTime = 3
            });
        }

        private void SuccessBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowSuccess("success");
            Growl.Success(new GrowlInfo()
            {
                IsCustom = true,
                StaysOpen = false,
                Message = "success",
                WaitTime = 3
            });
        }

        private void ErrorBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowError("error");
            Growl.Error(new GrowlInfo()
            {
                IsCustom = true,
                StaysOpen = false,
                Message = "error",
                WaitTime = 3
            });
        }

        private void MessageContainerBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.Show(Global.MessageContainerKey, "message");

        }

        private void InfoContainerBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowInfo(Global.MessageContainerKey, "info");
            Growl.Info("info", Global.GrowlContainerKey);
        }

        private void WaringContainerBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowWarning(Global.MessageContainerKey, "warning");
            Growl.Warning("warning", Global.GrowlContainerKey);
        }

        private void SuccessContainerBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowSuccess(Global.MessageContainerKey, "success");
            Growl.Success("success", Global.GrowlContainerKey);
        }

        private void ErrorContaionBtn_Click(object sender, RoutedEventArgs e)
        {
            Message.ShowError(Global.MessageContainerKey, "error");
            Growl.Error(new GrowlInfo()
            {
                IsCustom = true,
                StaysOpen = false,
                Message = "error",
                WaitTime = 3,
                Token = Global.GrowlContainerKey
            });
        }

        private void ControlBtn_Click(object sender, RoutedEventArgs e)
        {
            string xaml = System.Windows.Markup.XamlWriter.Save(CustomContent);
            UIElement element = System.Windows.Markup.XamlReader.Parse(xaml) as UIElement;
            Message.Show(element);
        }

        private void ControlContaionBtn_Click(object sender, RoutedEventArgs e)
        {
            string xaml = System.Windows.Markup.XamlWriter.Save(CustomContent);
            UIElement element = System.Windows.Markup.XamlReader.Parse(xaml) as UIElement;
            Message.Show(Global.MessageContainerKey, element);
        }
    }
}
